ISCSession Interface

The following table contains information on the ISCSession interface:

Signature

Description

Valid Arguments

VARIANT_BOOL Open(IUnknown * Unit, VARIANT Level [optional], VARIANT Flags [optional])

Binds self to the intrinsic metamodel, persistence unit, or model set identified by the Unit parameter

Unit:

  • NULL � The intrinsic metamodel for the top model set in a persistence unit. For the current version this is EMX class metadata.
  • ISCPropertyBag � The intrinsic metamodel defined by the metadata class in the first property of the bag.
  • ISCPersistenceUnit � The metamodel for the top model set in the persistence unit.
  • ISCModelSet � The metamodel for the model set.

Level:

  • SCD_SL_M1 � Metadata access.

Flags:

  • Empty � Defaults to SCD_SF_NONE.

Example 27

The following example illustrates how to access an intrinsic metamodel using C++. The example uses an Application object from Example 1:

void AccessMetaModel( ISCApplicationPtr & scAppPtr )
{   
    ISCSessionPtr scSessionPtr = scAppPtr->GetSessions()->Add();   // add a new 
    // session
    // Open EMX intrinsic metamodel
    CComVariant varResult = scSessionPtr->Open(NULL, (long) SCD_SL_M1);  //   meta-model level
    if (varResult.vt == VT_BOOL && varResult.boolVal == FALSE)
       return;
    // …
}

The following example illustrates how to access an intrinsic metamodel using Visual Basic .NET. The example uses an Application object from Example 1:

Public Sub AccessMetaModel( ByRef scApp As SCAPI.Application )
    Dim scBag As SCAPI.PropertyBag
    Dim scSession As SCAPI.Session
    
    ' Get a property bag with the EM2 metadata class
    scBag = scApp.ApplicationEnvironment.PropertyBag("Application ", "EM2 Metadata Class")
    ' Open EM2 intrinsic metamodel
    scSession = scApp.Sessions.Add
    scSession.Open( scBag, SCD_SL_M1 )
End Sub